#!/user/bin/env node

const log = console.log,
      fs = require('fs'),
      file = process.argv[3], 
      mod = process.argv[2];

if(process.argv.length === 2){
  console.error('请输入命令行参数！');
  process.exit(1);
}else if(!fs.existsSync(file)){
  console.error(`${file}not exist!`);
  process.ecit(2);
}
try{
  fs.chmodSync(file,mod);
  log('修改成功！')
  process.exit(3);
}catch(e){
  console.error(e.message);
  process.exit(4);
}

